<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑ECU</title>
    <link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" />
    <!-- ... 保持相同的样式 ... -->
     <style>
        body { background-color: #f5f5f5; }
        .container { width: 86%; margin: 0 auto; }
        .form-group { margin-bottom: 15px; }
        .form-group label { display: block; margin-bottom: 5px; }
        .form-group input, .form-group .layui-input-block { width: 100%; padding: 8px; box-sizing: border-box; }
        .form-group select { width: 70%; padding: 5px; box-sizing: border-box; }
        .layui-row {
            display: flex;
            align-items: center;
            margin-bottom: 4px;
            margin-top: 8px;
        }
         .grid-demo {
            display: flex; /* 确保子元素也使用 Flexbox */
            align-items: center; /* 垂直居中 */
          }
    </style>
</head>
<body>
    <div class="container">
        <form id="ecuForm" class="layui-form">
            <!-- 添加隐藏的id字段 -->
            <input type="hidden" id="id" name="id" value="{{ ecu.id }}">
            
            <!-- 保持与addEcuForm相同的表单结构 -->
            <!-- ... 其他表单字段 ... -->

			 <div class="layui-row" layui-col-space4>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
				<label class="layui-form-label">零部件名称</label>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
				 <input type="text" id="name" name="name" required lay-verify="required" class="layui-input" value="{{ ecu.name }}">
{#				 <input type="text" id="name" name="name" required lay-verify="required" class="layui-input" >#}
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
				<label class="layui-form-label">缩写</label>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
				<input type="text" id="abbr_ext" name="abbr_ext" value="{{ ecu.abbr_ext }}" required  class="layui-input" >
			   </div>
			  </div>
			 </div>
            {#----------------------------------------------------------------------#}
            <!-- <div class="layui-row" layui-col-space4>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
				    <label class="layui-form-label">硬件</label>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
				    <input type="checkbox" name="pcb" title="PCB" lay-skin="primary" value="√" {{ "checked" if ecu.pcb == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
                    <input type="checkbox" name="Bootloader" title="Bootloader" lay-skin="primary" value="√" {{ "checked" if ecu.Bootloader == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
                    <input type="checkbox" name="chipset" title="芯片" lay-skin="primary" value="√" {{ "checked" if ecu.chipset == "√" else "" }}>
			   </div>
			  </div>
			 </div>-->
            {#----------------------------------------------------------------------#}
                 <div class="layui-row" layui-col-space4>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
				    <label class="layui-form-label">操作系统</label>
			   </div>
			  </div>
			  <div class="layui-col-xs9">
			   <div class="grid-demo">
                    <select id="OS" name="OS" required lay-verify="required" class="layui-input">
                        <option value="Linux" {{ "selected" if ecu.OS == "Linux" else "" }}>Linux</option>
                        <option value="Android" {{ "selected" if ecu.OS == "Android" else "" }}>Android</option>
                        <option value="QNX" {{ "selected" if ecu.OS == "QNX" else "" }}>QNX</option>
                        <option value="RTOS" {{ "selected" if ecu.OS == "RTOS" else "" }}>RTOS</option>
                        <option value="HarmonyOS" {{ "selected" if ecu.OS == "HarmonyOS" else "" }}>HarmonyOS</option>
                        <option value="Windows" {{ "selected" if ecu.OS == "Windows" else "" }}>Windows</option>
                    </select>
			   </div>
			  </div>
			 </div>


            <div class="layui-row" layui-col-space4>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
				    <label class="layui-form-label">应用软件</label>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
				    <input type="checkbox" name="app" title="应用软件" lay-skin="primary" value="√" {{ "checked" if ecu.app == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
                    <input type="checkbox" name="app_3rd" title="第三方应用" lay-skin="primary" value="√" {{ "checked" if ecu.app_3rd == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">

			   </div>
			  </div>
			 </div>
            {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
				    <label class="layui-form-label">数据</label>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
				    <input type="checkbox" name="data_1" title="重要数据" lay-skin="primary" value="√" {{ "checked" if ecu.data_1 == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
                    <input type="checkbox" name="data_2" title="个人数据" lay-skin="primary" value="√" {{ "checked" if ecu.data_2 == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
                    <input type="checkbox" name="data_3" title="关键数据" lay-skin="primary" value="√" {{ "checked" if ecu.data_3 == "√" else "" }}>
			   </div>
			  </div>
			 </div>

            <div class="layui-row" layui-col-space4>
              <div class="layui-col-xs3">
                <div class="grid-demo grid-demo-bg1">
                   <!-- 空 label 占位 -->
                </div>
              </div>
              <div class="layui-col-xs3">
                <div class="grid-demo">
                  <input type="checkbox" name="data_key" title="密钥数据" lay-skin="primary" value="√" {{ "checked" if ecu.data_key == "√" else "" }}>
                </div>
              </div>
              <div class="layui-col-xs3">
                <div class="grid-demo grid-demo-bg1">
                  <input type="checkbox" name="data_car_info" title="车辆识别码" lay-skin="primary" value="√" {{ "checked" if ecu.data_car_info == "√" else "" }}>
                </div>
              </div>
              <div class="layui-col-xs3">
                <div class="grid-demo grid-demo-bg1">
                  <input type="checkbox" name="data_log" title="日志" lay-skin="primary" value="√" {{ "checked" if ecu.data_log == "√" else "" }}>
                </div>
              </div>
            </div>

            <div class="layui-row" layui-col-space4>
              <div class="layui-col-xs3">
                <div class="grid-demo grid-demo-bg1">
                  <!-- 空 label 占位 -->
                </div>
              </div>
              <div class="layui-col-xs3">
                <div class="grid-demo">
                  <input type="checkbox" name="data_export" title="外发数据" lay-skin="primary" value="√" {{ "checked" if ecu.data_export == "√" else "" }}>
                </div>
              </div>
              <div class="layui-col-xs3">
                <div class="grid-demo grid-demo-bg1">
                  <input type="checkbox" name="data_cross_border" title="跨境数据" lay-skin="primary" value="√" {{ "checked" if ecu.data_cross_border == "√" else "" }}>
                </div>
              </div>
              <div class="layui-col-xs3">
                <div class="grid-demo">
                  <!-- 空占位 -->
                </div>
              </div>
            </div>

             {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
				    <label class="layui-form-label">物理接口</label>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
				    <input type="checkbox" name="interface_usb" title="USB接口" lay-skin="primary" value="√" {{ "checked" if ecu.interface_usb == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo grid-demo-bg1">
                    <input type="checkbox" name="interface_sd" title="SD卡接口" lay-skin="primary" value="√" {{ "checked" if ecu.interface_sd == "√" else "" }}>
			   </div>
			  </div>
			  <div class="layui-col-xs3">
			   <div class="grid-demo">
                   <input type="checkbox" name="interface_debug" title="调试接口" lay-skin="primary" value="√" {{ "checked" if ecu.interface_debug == "√" else "" }}>
			   </div>
			  </div>
			 </div>
            {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <label class="layui-form-label">内部通信</label>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="can_bus" title="CAN通信" lay-skin="primary" value="√" {{ "checked" if ecu.can_bus == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <input type="checkbox" name="eth_bus" title="以太通信" lay-skin="primary" value="√" {{ "checked" if ecu.eth_bus == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
{#                        <input type="checkbox" name="eth_bus" title="LIN通信" lay-skin="primary" value="√" {{ "checked" if ecu.eth_bus == "√" else "" }}>#}
                    </div>
                </div>
            </div>

            {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <label class="layui-form-label">无线通信</label>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="wireless_bt" title="蓝牙" lay-skin="primary" value="√" {{ "checked" if ecu.wireless_bt == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <input type="checkbox" name="wireless_wifi" title="WIFI" lay-skin="primary" value="√" {{ "checked" if ecu.wireless_wifi == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="wireless_rf" title="射频通信" lay-skin="primary" value="√" {{ "checked" if ecu.wireless_rf == "√" else "" }}>
                    </div>
                </div>
            </div>
            {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">

                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="wireless_mobile" title="蜂窝通信" lay-skin="primary" value="√" {{ "checked" if ecu.wireless_mobile == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <input type="checkbox" name="wireless_gnss" title="GNSS" lay-skin="primary" value="√" {{ "checked" if ecu.wireless_gnss == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="wireless_v2x" title="V2X" lay-skin="primary" value="√" {{ "checked" if ecu.wireless_v2x == "√" else "" }}>
                    </div>
                </div>
            </div>

            {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <label class="layui-form-label">重要功能</label>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="ota_upgrade" title="OTA升级" lay-skin="primary" value="√" {{ "checked" if ecu.ota_upgrade == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <input type="checkbox" name="usb_upgrade" title="USB升级" lay-skin="primary" value="√" {{ "checked" if ecu.usb_upgrade == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="obd_upgrade" title="OBD升级" lay-skin="primary" value="√" {{ "checked" if ecu.obd_upgrade == "√" else "" }}>
                    </div>
                </div>
            </div>
            {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <!-- 空 label 占位 -->
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="obd_debug" title="OBD诊断" lay-skin="primary" value="√" {{ "checked" if ecu.obd_debug == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="remote_debug" title="远程诊断" lay-skin="primary" value="√" {{ "checked" if ecu.remote_debug == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <input type="checkbox" name="intrusion_detection_prevention_systems" title="IDPS" lay-skin="primary" value="√" {{ "checked" if ecu.intrusion_detection_prevention_systems == "√" else "" }}>
                    </div>
                </div>
            </div>


            {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <label class="layui-form-label">ECU功能</label>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="upgrade_node" title="升级主控节点" lay-skin="primary" value="√" {{ "checked" if ecu.upgrade_node == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo">
                        <input type="checkbox" name="tbox" title="通信主节点" lay-skin="primary" value="√" {{ "checked" if ecu.tbox == "√" else "" }}>
                    </div>
                </div>
                <div class="layui-col-xs3">
                    <div class="grid-demo grid-demo-bg1">
                        <input type="checkbox" name="gate_way" title="网关" lay-skin="primary" value="√" {{ "checked" if ecu.gate_way == "√" else "" }}>
                    </div>
                </div>
            </div>

              {#----------------------------------------------------------------------#}
            <div class="layui-row" layui-col-space4>
			  <div class="layui-col-xs3">
			    <div class="grid-demo grid-demo-bg1">
				    <label class="layui-form-label">CAL級別</label>
			    </div>
			  </div>

              <div class="layui-col-xs3">
			    <div class="grid-demo">
                    <select id="affect_level" name="affect_level" required lay-verify="required" class="layui-input">
                        <option value="Negligible" {% if ecu.affect_level == 'Negligible' %}selected{% endif %}>Negligible</option>
                        <option value="Moderate" {% if ecu.affect_level == 'Moderate' %}selected{% endif %}>Moderate</option>
                        <option value="Major" {% if ecu.affect_level == 'Major' %}selected{% endif %}>Major</option>
                        <option value="Severe" {% if ecu.affect_level == 'Severe' %}selected{% endif %}>Severe</option>
                    </select>
                </div>
              </div>

              <div class="layui-col-xs3">
			    <div class="grid-demo">
                    <select id="attack_type" name="attack_type" required lay-verify="required" class="layui-input">
                        <option value="Physical" {% if ecu.attack_type == 'Physical' %}selected{% endif %}>Physical</option>
                        <option value="Local" {% if ecu.attack_type == 'Local' %}selected{% endif %}>Local</option>
                        <option value="Adjacent" {% if ecu.attack_type == 'Adjacent' %}selected{% endif %}>Adjacent</option>
                        <option value="Network" {% if ecu.attack_type == 'Network' %}selected{% endif %}>Network</option>
                    </select>
                </div>
              </div>

              <div class="layui-col-xs3">
			    <div class="grid-demo">
				  <input type="text" id="cal_level" name="cal_level" value="{{ ecu.cal_level }}" required  class="layui-input" >
			    </div>
			  </div>

			 </div>

        </form>
    </div>

    <script src="/static/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script>

    </script>
</body>
</html>
